using UnityEngine;
using System.Collections;

public class StateZombieAtack : State<ZombieControl>   {

    static StateZombieAtack m_instance = new StateZombieAtack();
    public static StateZombieAtack instance { get { return m_instance; } }
   
    public override void OnEnter(ZombieControl behaviour)
    {
        Debug.Log("ZOMBIE: Empiezo a atacar");
		foreach (AnimationState state in behaviour.animation) {
        	state.speed = 2F;
    	}
		behaviour.animation.Play("Atacar2");
		behaviour.ProducirDmg();
        behaviour.time = Time.timeSinceLevelLoad;
    }

    public override void OnUpdate(ZombieControl behaviour)
    {

        if ((behaviour.time + behaviour.ATACKSPEED) < Time.timeSinceLevelLoad)
        {
            behaviour.time = Time.timeSinceLevelLoad;
            // behaviour.State = StateZombieRun.instance;
            behaviour.animation.Play("Atacar2");
			behaviour.ProducirDmg();
			
        }
    }

    public override void OnExit(ZombieControl behaviour)
    {
        Debug.Log("ZOMBIE: Termino de atacar");
    }

    public override void OnAction(string name, ZombieControl behaviour, object value)
    {

    }

}
